﻿using LY.DataAccess.Repositor;
using LY.DataAccess.Repository;
using LY.Entity;
using LY.Entity.Entities;
using LY.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LY.Business.ServiceImpl
{
   public class AccountService:IAccountService
    {
       AccountRepository _aservice;
       private FundsFlowRepository _fundsFlowRepository;
       public AccountService() 
       {
           _aservice = new AccountRepository();
           _fundsFlowRepository = new FundsFlowRepository();
       }

       public U_Account GetAccount(int? id) 
       {
           return _aservice.GetAccount(id);
       }
       //修改支付密码
       public int UpdatePaypwd(int? id, string password)
       {
           return _aservice.UpdatePaypwd(id, password);
       }
       //设置支付密码
       public int InsertAccount(U_Account account) 
       {
           return _aservice.InserAccount(account);
       }

       /*
       //活动专区
       public List<U_Activity_EX> GetActivity()
       {
           return _aservice.GetActivity();
       }

       //根据活动ID 检索会员参加的活动抽奖记录
       public List<GoldExperience_EX> GetGoldList(int activityId, int memberId)
       {
           return _aservice.GetGoldList(activityId,memberId);
       }
       */


       //获取账户总览信息
       public List<decimal> QueryAccountInfo(int memberId)
       {
           //账户总资产
           List<decimal> list = new List<decimal>();
           list.Add(_fundsFlowRepository.QueryMoney(memberId,1)); //总资产
           list.Add(_fundsFlowRepository.QueryMoney(memberId, 2)); //余额
           list.Add(_fundsFlowRepository.QueryMoney(memberId, 3)); //累计充值
           list.Add(_fundsFlowRepository.QueryMoney(memberId,4)); //累计投资
           list.Add(_fundsFlowRepository.QueryMoney(memberId,5)); //累计收益 
           return list;
       }


      
    }
}
